﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="InsertQianMing.aspx.cs" Inherits="OA.aspx.Main.InsertQianMing" %>

<html>
<head>
    <title>选择条件</title>
    <meta http-equiv="Content-Language" content="zh-cn">
    <link href="../../Style/Style.css" type="text/css" rel="STYLESHEET">
    <script src="../../JS/jquery-1.11.0.min.js"></script>
    <script src="../../JS/jSignature/jSignature.js"></script>
    <base target="_self" />
    <script language="javascript">
        //function sendFromChild() {
        //    if (window.showModalDialog != undefined) {
        //        window.returnValue = "InsertQianZhang.jpg";
        //    } else {

        //        window.opener.callbackqianming("InsertQianZhang.jpg");
        //        window.close()
        //    }
        //    //                window.close();  
        //}

        function CCC() {
            window.returnValue = "";
            //                window.close();  
        }
    </script>
</head>
<body scroll="no">
   <%-- <input type="button" value=" 撤销 " onclick="undo()" />
    <input type="button" value=" 重做 " onclick="redo()" />
    <input type="button" value=" 清除 " onclick="Clear()" />
    <input type="button" value=" 加粗 " onclick="ChangeWidth(1)" />
    <input type="button" value=" 变细 " onclick="ChangeWidth(-1)" /><br />
    <input type="button" value=" 黑笔 " onclick="ChangeColor(0x000000)" />
    <input type="button" value=" 红笔 " onclick="ChangeColor(0x0000ff)" />
    <input type="button" value=" 绿笔 " onclick="ChangeColor(0x00ff00)" />
    <input type="button" value=" 蓝笔 " onclick="ChangeColor(0xff0000)" />
    <div id="containerDiv" style="border: 1px solid #9db3c5; width: 400px; height: 300px">
        <object id="SignPanel" classid="CLSID:6F752F76-0FFD-4FE2-B9FB-051400791462" codebase="sw.cab#Version=1,0,0,1">
        </object>
    </div>--%>
     <div id="signature" style="border: 1px solid #9db3c5; width: 400px; height: 300px"></div>
    <button type="button" onclick="jSignatureTest()">生成签名</button>
    <button type="button" onclick="reset()">重置签名</button>
    <%--<div id="image" style="margin:20px"></div>--%>
    <div id="someelement" ><img src="" id="images"></div>
    <form id="form1" method="post" runat="server">
        <asp:Button ID="Button1" runat="server" OnClientClick="javascript:show()" Text="确认提交" OnClick="Button1_Click" />
      <asp:TextBox Width="0" Height="0" ID="tbSignData" runat="server"></asp:TextBox>
    </form>

    <script type="text/javascript">
        $(function () {
            //初始化插件
            $("#signature").jSignature({ height: 300, width: 400 });
        })

        //输出签名图片
        function jSignatureTest() {
            //var $sigdiv = $("#signature");
            //var datapair = $sigdiv.jSignature("getData", "svgbase64")
            //console.log(datapair);
           
            //var img = new Image();
            //img.src = "data:" + datapair[0] + "," + datapair[1]
            //$(img).appendTo($("#image"))

            var $signature = $("#signature")
            var datapair = $signature.jSignature("getData", "image");
            console.info(datapair);
            $("#images").attr('src', 'data:' + datapair[0] + "," + datapair[1]);
            var src_data = $("#images").attr('src');//拿到图片中的src，这就是我们需要的base64
            document.getElementById("tbSignData").value = src_data;
        }

        function reset() {
            var $sigdiv = $("#signature");
            $sigdiv.jSignature("reset");
        }
    </script>

</body>
</html>
